package com.wolfking.jeesite.mapper;

import com.wolfking.jeesite.entity.Menu;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * 菜单的mapper
 * <P>
 * 
 * @author wolfking@赵伟伟
 * @mail zww199009@163.com
 * @创作日期 2017年4月27日下午1:54:46
 * @版权 归wolfking所有
 */
@Mapper
public interface MenuMapper extends com.baomidou.mybatisplus.core.mapper.BaseMapper<Menu> {

    @Select("select DISTINCT m.* from sys_user_role ur \n" +
            "INNER JOIN sys_role r on ur.role_id = r.id \n" +
            "INNER JOIN sys_role_menu rm on rm.role_id = r.id\n" +
            "INNER JOIN sys_menu m on m.id = rm.menu_id\n" +
            "WHERE ur.user_id = #{userId} and m.is_show = '1'")
    List<Menu> getUserAllMenu(@Param("userId") Integer userId);
}
